package com.hyt.it.ogt.kq.service.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hyt.core.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.codehaus.jackson.annotate.JsonIgnore;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
 * <p>
 * 科目信息表
 * </p>
 *
 * @author huangyh
 * @since 2021-03-08
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("kw_subject")
@ApiModel(value="KwSubject对象", description="科目信息表")
public class Subject extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @NotBlank(message = "考试任务id不能为空")
    @ApiModelProperty(value = "考试任务id(前端必传)")
    private String taskId;
    
    @ApiModelProperty(value = "父节点id")
    private String parentId;

    @NotBlank(message = "科目编号不能为空")
    @ApiModelProperty(value = "科目编号(前端必传)")
    private String code;

    @NotBlank(message = "科目名称不能为空")
    @ApiModelProperty(value = "科目名称(前端必传)")
    private String name;

    @NotNull(message = "考试时长不能为空")
    @ApiModelProperty(value = "考试时长(前端必传)")
    private BigDecimal length;

    @NotNull(message = "开考后允许交卷分钟数不能为空")
    @ApiModelProperty(value = "开考后允许交卷分钟数(前端必传)")
    private BigDecimal handInTime;

    @NotNull(message = "结束前提醒交卷分钟数不能为空")
    @ApiModelProperty(value = "结束前提醒交卷分钟数(前端必传)")
    private BigDecimal remindTime;

    @ApiModelProperty(value = "打包方式，PAK1，PAK2，PAK3")
    private String packType;

    @ApiModelProperty(value = "多模块作答方式，1：同时作答，统一交卷；2：分开作答交卷，各模块答题顺序相同；3：分开作答交卷，各模块答题顺序随机")
    private Integer examModel;

    @ApiModelProperty(value = "云考试报名科目id")
    private String bmSubjectId;

    @ApiModelProperty(value = "所属机构id")
    @TableField("office_id")
    private String officeId;

    @ApiModelProperty(value = "所属部门id")
    @TableField("dept_id")
    private String deptId;

    @ApiModelProperty(value = "年级")
    @TableField("grade")
    private String grade;

    @ApiModelProperty(value = "考场类型")
    @TableField("room_type_id")
    private String roomTypeId;

    @ApiModelProperty(value = "考场类型名称")
    @TableField("room_type_name")
    private String roomTypeName;

    @ApiModelProperty(value = "科目年级描述")
    @TableField("grand_desc")
    private String grandDesc;

    @ApiModelProperty(value = "科目名称")
    @TableField(exist = false)
    private String subjectName;

    @ApiModelProperty(value = "所属部门名称")
    @TableField(exist = false)
    private String deptName;
    
    public static String getSubjectCacheKey(String taskId, String subjectId ) {
    	StringBuilder sb = new StringBuilder();
    	sb.append("KW_GOV_SB");
    	sb.append(":");
    	sb.append(taskId);
    	sb.append(":");
    	sb.append(subjectId);
		return sb.toString();
    }
    

}
